package com.dushibao.web.artile;

import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;

@WebServlet("/article/add")
public class AddServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BufferedReader br = req.getReader();
        StringBuilder article = new StringBuilder();

        String line = null;
        while( (line = br.readLine()) != null){
            article.append(line);
        }

        System.out.println(article.toString());
        resp.getWriter().write(JSON.toJSONString("ok"));
    }
}
